import {} from 'react';
import {Modal,Button} from "antd";

const Dialog = (props) => {
    let {title, visible, onOk, setVisible, width=520, clear,CancelBtnShow=true} = props;
    const Footer = (_, { OkBtn, CancelBtn }) => (
        <>
          <CancelBtn />
         {CancelBtnShow? <OkBtn />:null}
        </>
      )
    return (
        <Modal
            width={width}
            title={title}
            visible={visible}
            onOk={onOk}
            onCancel={()=> {
                setVisible(false)
                if (clear) {
                    clear()
                }
            }}
            footer={Footer}
        >
            {props.children}
        </Modal>
    );
};

export default Dialog;